package bean;

import Interfaces.StudentImpl;

/**
 * @author: android 超级兵
 * @create: 2022-01-17 16:58
 * TODO
 **/
public class StudentBean1 implements StudentImpl {
    private String name = "";
    private int age = 0;


    @Override
    public synchronized String getName() throws InterruptedException {
        // sleep 5ms 模拟网络请求
        Thread.sleep(5);
        return name;
    }

    @Override
    public synchronized int getAge() throws InterruptedException {
        // sleep 5ms 模拟网络请求
        Thread.sleep(5);
        return age;
    }

    @Override
    public synchronized void setName(String name) throws InterruptedException {
        // sleep 5ms 模拟网络请求
        Thread.sleep(5);
        this.name = name;
    }

    @Override
    public synchronized void setAge(int age) throws InterruptedException {
        // sleep 5ms 模拟网络请求
        Thread.sleep(5);
        this.age = age;
    }
}
